

# 添加员工
import requests

add_emp_url = "http://ihrm2-test.itheima.net/api/sys/user"
add_emp_header = {"Content-Type":"application/json", "Authorization":"9f79fe2c-0e05-430b-9570-e7ad19167f82"}
add_emp_body = {

    "username": "小猪佩奇",
    "mobile": "15912312145",
    "workNumber": "22"
}
add_emp_resp = requests.post(url=add_emp_url,headers=add_emp_header,json=add_emp_body)

# 查询员工

query_emp_url = "http://ihrm2-test.itheima.net/api/sys/user/员工id"
query_emp_header =  {"Authorization": "9f79fe2c-0e05-430b-9570-e7ad19167f82"}
query_emp_resp = requests.get(url=query_emp_url,data=query_emp_header)

# 修改员工
modify_emp_url = "http://ihrm2-test.itheima.net/api/sys/user/员工id"
modify_emp_header = {"Content-Type": "application/json", "Authorization": "9f79fe2c-0e05-430b-9570-e7ad19167f82"}
modify_emp_body = {"username": "齐天大圣"}
modify_emp_resp = requests.put(url=modify_emp_url,headers=modify_emp_header,json=modify_emp_body)

# 删除员工
del_emp_url = " http://ihrm2-test.itheima.net/api/sys/user/员工id"
del_emp_header = {"Authorization": "9f79fe2c-0e05-430b-9570-e7ad19167f82"}
del_emp_resp = requests.delete(url=del_emp_url,headers=del_emp_header)
